﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MipsPipelineSimulator
{
    public partial class DefinedMsgBox : Form
    {
        private String name = "";

        private String msg = "";

        public DefinedMsgBox()
        {
            InitializeComponent(); 
        }

        public DefinedMsgBox(String name,String msg)
        {
            InitializeComponent();
            this.msg = msg;
            this.name = name;
        }

        private void DefinedMsgBox_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Size size = g.MeasureString(msg, this.msglabel.Font).ToSize();
            msglabel.Size = size;
            msglabel.Text = msg;
            this.Text = name;
            this.Size = new Size(size.Width + 80, size.Height + 100);
            msglabel.Location = new Point(40, 20);
            okButton.Location = new Point(this.Size.Width / 2 - size.Width / 2, this.Size.Height - 60);
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
